package com.wyebus.boss.web;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Sokos Lee
 * 2016-10-19
 */
@SpringBootApplication
@MapperScan(basePackages={"com.wyebus.boss.modules.sys.dao"})
@ComponentScan(basePackages={
		"com.wyebus.boss.modules.sys.service",
		"com.wyebus.boss.common.cache",
		"com.wyebus.boss.common.utils",
		"com.wyebus.boss.utils",
		"com.wyebus.boss.web.common.aspect",
		"com.wyebus.boss.web.config",
		"com.wyebus.boss.web.sys.controller",
		"com.wyebus.boss.modules.sys.service.impl",
		"com.wyebus.boss.web.sys.shiro",
		"com.wyebus.boss.service",
		"com.wyebus.boss.web"
})
@EnableTransactionManagement 
public class BossApplication extends SpringBootServletInitializer {
	
	private static final Logger logger = LoggerFactory.getLogger(BossApplication.class);

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try{
			logger.debug("Application Beginning");
			SpringApplication.run(BossApplication.class, args);
		}catch(Exception ex){
			logger.error(ex.getMessage(), ex);
		}
	}
	
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(BossApplication.class);
	}
}